<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich">
	<!-- imports -->
	<script language="JavaScript" src="../js/openWindow.js"></script>
	<!-- imports -->
		<rich:popupPanel id="surveyDetail" autosized="true" modal="true" moveable="true" show="#{SurveyViewBean.showInnerComp}">
		<f:facet name="header"><center>Umfrage Detail</center></f:facet>
		<center><h:outputLabel value="Umfrage ändern/löschen" styleClass="ueberschrift"/></center>
		<h:form id="survey_inner_change_form">
		
		<table id="Umfrage_aendern_table" class="standart kontoverwaltung" width="500px">
			<tr>
				<td>Bezeichnung:</td>
				<td><h:inputText readonly="#{!SurveyViewBean.canAccessAll()}" value="#{SurveyViewBean.labelChange}" maxlength="30"/> </td>
			</tr>
			<tr>
				<td>Status</td>
				<td><h:selectBooleanCheckbox disabled="#{!SurveyViewBean.canAccessAll()}" value="#{SurveyViewBean.statusChange}" >
				<a4j:ajax event="change" render="survey_inner_change_form"/>
				</h:selectBooleanCheckbox>
				<h:outputText value="#{SurveyViewBean.statusChange == true ? ' Aktiv ' : ' nicht Aktiv '}" />
				<h:graphicImage value="/images/#{SurveyViewBean.statusChange == true ? 'A' : 'N'}active.png" height="10px"/>
				</td>
			</tr>
			<tr>
				<td>Anonyme</td>
				<td><h:graphicImage value="/images/#{SurveyViewBean.selectedRow.autorized == true ? 'N' : 'A'}active.png" height="10px"/></td>
			</tr>
			<tr>
				<td colspan="3"><center><hr width="80%"/></center></td>
			</tr>
			<tr>
				<td colspan="3"><center>
				<rich:dataScroller execute="survey_inner_change_form"  for="tan_table" maxPages="5" id="tandatascrolleroben" render="tandatascrollerunten"/>
					<rich:extendedDataTable rows="7" frozenColumns="3" noDataLabel="keine Tans verfügbar" value="#{SurveyViewBean.tansFromSelectedRow}" id="tan_table" var="tan">
						<rich:column width="250px" >
							<f:facet name="header">tan_nummer</f:facet>
							<h:outputText value="#{tan.tan_nummer}_#{tan.tankey}" />
						</rich:column>
						<rich:column width="75px">
							<f:facet name="header">verbraucht</f:facet>
							<center><h:graphicImage value="/images/#{tan.active == true ? 'A' : 'N'}active.png" height="10px"/></center>
						</rich:column>
						<rich:column width="75px">
							<h:commandLink id="link#{tan.tan_nummer}" value="zur Umfrage" action="#{GenericSurveySessionBean.goinToRootSituation()}">
							<a4j:ajax event="click" execute="@this" listener="#{GenericSurveySessionBean.goinToRootSituation()}" oncomplete="openMyWindow('GenericSurvey.jsf?tan=#{tan.tan_nummer}_#{tan.tankey}');"/>
							</h:commandLink>
						</rich:column>
					</rich:extendedDataTable>
					<rich:dataScroller execute="survey_inner_change_form" for="tan_table" maxPages="5" id="tandatascrollerunten" render="tandatascrolleroben"/></center>
				</td>
			</tr>
			<tr>
				<td colspan="3"><center><hr width="80%"/></center></td>
			</tr>
			<tr>
				<td>Anzahl neuer Tans</td>
				<td colspan="2"><rich:inputNumberSpinner value="#{SurveyViewBean.newtans}" showArrows="true" inputPosition="bottom" minValue="1" maxValue="20" enableManualInput="false"/></td>
			</tr>
			<tr>
				<td colspan="3"><center><a4j:commandButton execute="survey_inner_change_form" action="#{SurveyViewBean.generateTans()}" onbegin="#{rich:component('Loadingpopup')}.show();" oncomplete="#{rich:component('Loadingpopup')}.hide();" disabled="#{!SurveyViewBean.canAccessAll()}" value="neue tans generieren" render="Messagespopup survey_inner_change_form"/></center></td>
			</tr>
			<tr>
				<td colspan="3"><center><hr width="80%"/></center></td>
			</tr>
			<tr>
				<td><center><a4j:commandButton execute="survey_inner_change_form" action="#{SurveyViewBean.ChangeSurvey()}" disabled="#{!SurveyViewBean.canAccessAll()}" onbegin="#{rich:component('Loadingpopup')}.show();" oncomplete="#{rich:component('Loadingpopup')}.hide();" value="speichern"  render="Messagespopup survey_table survey_inner_change_form"/></center></td>
				<td><center><a4j:commandButton execute="survey_inner_change_form" action="#{SurveyViewBean.DeleteSurvey()}" disabled="#{!sessionManagerBean.userinfo.user.benutzerrolle.bezeichnung.equals('Administrator')}" onbegin="#{rich:component('Loadingpopup')}.show();" oncomplete="#{rich:component('Loadingpopup')}.hide();#{rich:component('surveyDetail')}.hide();"  value="löschen" render="Messagespopup survey_table"/></center></td>
				<td><center><a4j:commandButton execute="@this" action="#{SurveyViewBean.innerCompHide()}" onclick="#{rich:component('surveyDetail')}.hide();" value="abbrechen"/></center></td>
			</tr>
		</table>	
		</h:form>		
		</rich:popupPanel>										
</ui:composition>